Your software draws images to a video output component in the same way that it draws to other video outputs: through a QuickDraw graphics world. You do this as follows:
If any other software is using the video output device, QTVideoOutBegin returns the error code videoOutputInUseErr . If this happens, your software can call the QTVideoOutGetCurrentClientName function to get the name of the software and then display an alert that says that the output device is not available and notes the software that is currently using it.
This invokes the Image Compression Manager, which locates a image decompressor component that can convert the image into the pixel format required by the video output device.
The image decompressor component then delivers the video data to the video output device, which displays the image on the video output hardware.
Listing 2 illustrates how to create the image sequence and send it to the video output component.
Listing 2Creating and sending an image sequence to a video output component
OSErr MakeImageSequenceForGWorld (GWorldPtr gw,
GWorldPtr dest,
long *imageSize,
ImageSequence *seq)
{
OSErr err = noErr;
ImageDescriptionHandle desc = nil;
ImageDescriptionPtr dp;
PixMapHandle pixmap = gw->portPixMap;
Rect bounds = (**pixmap).bounds;
*seq = nil;
*imageSize = ((**pixmap).rowBytes & 0x3fff) * dp->height;
err = MakeImageDescriptionForPixMap (gw, &desc);
if (err) goto bail;
err = DecompressSequenceBeginS (seq, desc, dest, nil,
&bounds, nil, ditherCopy,
(RgnHandle)nil, 0,
codecNormalQuality, anyCodec);
if (err) goto bail;
bail:
if (desc) DisposeHandle ((Handle)desc);
return err;
}
{
QTVideoOutputComponent videoOutput;
GWorldPtr drawingBuffer = nil;
GWorldPtr destGWorld;
ImageSequence seq = nil;
long imageSize;
CodecFlags outFlags;
QTVideoOutGetGWorld (videoOutput, &destGWorld);
LockPixels (drawingBuffer->portPixMap);
MakeImageSequenceForGWorld (drawingBuffer, destGWorld,
&imageSize, &seq);
DecompressSequenceFrameS(seq,
GetPixBaseAddr (drawingBuffer->portPixMap),
imageSize, 0, &outFlags, nil);
}